// JavaScript Document
function submitFormtoUrl(formId,url){ 
	var theForm = document.getElementById(formId);
	theForm.action = url;	
	theForm.submit();	
	return true;
}

var checkValue;
function check(ckb){
	var theForm = document.adminForm;
	if(ckb.checked == true) theForm.boxchecked.value ++; else theForm.boxchecked.value --;
}
var checked=false;


function checkedAll() {
    var theForm = document.getElementById('adminForm');
    if (checked == false)
    {
    	checked = true;
    	checkValue = theForm.elements.length;
    }
    else
    {
    	checked = false;
    	checkValue = 0;
    }
    
    var countCheckBox = 0;
    var i;
    for (i=0; i<theForm.elements.length; i++) {
        if (theForm.elements[i].name=='cid[]'){
            theForm.elements[i].checked = checked;
            countCheckBox++;
        }
    }
    
    if (checked == true)
    {
    	checkValue = countCheckBox;
    }
    else
    {    	
    	checkValue = 0;
    }
    theForm.boxchecked.value = checkValue;
}

function  toolbarButtonSubmit(url,needCheck,needCheckMsg,needConfirm,needConfirmMsg){ 
	if(needCheck == 1){
		if (document.adminForm.boxchecked.value==0){ alert(needCheckMsg); return false;}
	}
	if(needConfirm == 1){
		var answer = confirm(needConfirmMsg);
		//alert(answer);
		if (answer){
			var theForm = document.getElementById("adminForm");
			theForm.action = url;	
			theForm.submit();	
			return true;
		}
	}
}

function areaLoadUrl(area, url){
	$(area).load(url);
}
function areaLoadUrlSerial(area,url,formId){
	  $(area).load(url,  
	  $(formId).serializeArray(  ));
}